<template>
  <div class="page-wrapper">
    <div class="page-wrapper__body">
      <div class="page-container is-form" v-loading="isLoading">
        <el-form ref="roleForm" :model="model" label-width="140px" label-position="left">
          <div class="block-title"><i>¶</i><el-button type="default" icon="el-icon-back" round size="mini" class="more" @click="onBack">返回</el-button> 岗位招聘信息</div>
          <div style="height:20px;"></div>
          <el-form-item label="招聘范围: ">
            <p class="form-text" v-html="model.recScope"></p>
          </el-form-item>
          <el-form-item label="招聘单位: ">
            <p class="form-text" v-html="model.recDept"></p>
          </el-form-item>
          <el-form-item label="岗位名称: ">
            <p class="form-text" v-html="model.jobName"></p>
          </el-form-item>
          <el-form-item label="招聘数量: ">
            <p class="form-text" v-html="model.jobNeed"></p>
          </el-form-item>
          <el-form-item label="年龄要求: ">
            <p class="form-text" v-html="model.eduDegree"></p>
          </el-form-item>
          <el-form-item label="学历: ">
            <p class="form-text" v-html="model.jobName"></p>
          </el-form-item>
          <el-form-item label="专业要求: ">
            <p class="form-text" v-html="model.major"></p>
          </el-form-item>
          <el-form-item label="职称及执业资格: ">
            <p class="form-text" v-html="model.jobPraQua"></p>
          </el-form-item>
          <el-form-item label="职务职级要求: ">
            <p class="form-text" v-html="model.jobRank"></p>
          </el-form-item>
          <el-form-item label="其他任职条件: ">
            <p class="form-text" v-html="model.jobDesc"></p>
          </el-form-item>
          <el-form-item label="放宽条件: ">
            <p class="form-text" v-html="model.jobSpec"></p>
          </el-form-item>
          <el-form-item label="工作地点: ">
            <p class="form-text" v-html="model.workPlace"></p>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
    import {getDetail} from "../../api/job/nengyuan";

    export default {
        name: "detail",
        data(){
            return{
                model:{},
                params:{
                    id:0
                },
                isLoading:false
            }
        },
        methods:{
            onBack(){
                this.$router.push('/nengyuan/job/list')
            },
            async loadData(){
                if(this.params.id <= 0){
                    this.$alert('参数错误', '提示', { confirmButtonText: '确定',okFn: ()=> {
                            this.onBack()
                        }});
                    return false;
                }
                this.isLoading = true;
                let resp = await getDetail(this.params.id);
                if(!this.qUtil.validResp(resp)){
                    this.isLoading = false;
                    this.$alert('请求数据失败!', '提示', { confirmButtonText: '确定',okFn: ()=> {
                            this.onBack()
                        }});
                    return false;
                }
                this.model = resp.data.model || {};
                this.model.jobDesc = this.model.jobDesc.replace(/\n/g, '\<br\/\>');
                this.model.jobSpec = this.model.jobSpec.replace(/\n/g, '\<br\/\>');
                this.isLoading = false;
            },
        },
        mounted(){
            this.params.id = parseInt(this.$route.params.id) || 0;
            this.loadData();
        }
    }
</script>

<style scoped>
  .form-text{
    margin-top:-6px;
    text-align: left;
    line-height: 30px;
    font-size:14px;
    color:#666;
  }
</style>